I've written one optimization script for my emulators, and this notebook just copies the script to each of my different models.

For stat in [wp, ds]: # cic]

For model in [HOD, HSAB, CorrAB, CAB]:

    optimize

In [21]:
import yaml
import copy
from os import path
import numpy as np

In [22]:
sbatch_template = """#!/bin/bash
#SBATCH --job-name=optimize_lpw_{stat}_{model}
#SBATCH -p kipac
#SBATCH --time=01:00:00
#SBATCH -o optimize_lpw_{stat}_{model}.out 
####SBATCH --exclusive
#SBATCH --cpus-per-task=8
####SBATCH --mem-per-cpu=MaxMemPerCPU

module load python/2.7.13
module load py-scipystack
module load hdf5/1.10.0p1

python /home/users/swmclau2/Git/pearce/bin/optimization/optimize_lpw.py\
                       ~/scratch/{stat}_{model2}/Pearce{Stat}{Model}Cosmo.hdf5\
                       ~/scratch/{stat}_{model2}_test/Pearce{Stat}{Model}CosmoTest.hdf5\
                       {stat}_{model}_emu_cov.npy\
                       {cosmo_idx} {hod_idx} {r_idx}"""

In [23]:
jobname_template = '/home/users/swmclau2/Git/pearce/bin/optimization/optimize_lpw_{stat}_{model}.sbatch'

In [24]:
cosmo_idx = 2
hod_idx = 0
r_idx = 1

In [25]:
for Stat in ['Wp', 'Ds']:
    stat = Stat.lower()
    
    for Model in ['HOD', 'HSAB', 'CorrAB', 'CAB']:
        
        model = Model.lower()
        model2 = 'zheng07' if model == 'hod' else model
        Model = '' if Model =='HOD' else Model
        jobname = jobname_template.format(stat=stat, model=model)
        
        with open(jobname, 'w') as f:
            f.write(sbatch_template.format(stat=stat, model=model, model2=model2, Stat=Stat, Model=Model,\
                                            cosmo_idx=cosmo_idx, hod_idx=hod_idx, r_idx=r_idx))

In [26]:
# TODO different opt scripts to test downsampling, test diff kernels, etc

In [ ]: